﻿#ifndef InstructionDataReaderStopCollection
#define INSTRUCTIONDATAREADERSTOPCOLLECTION
#include "ScriptInstruction.h"

class InstructionDataReaderStopCollection :public ScriptInstruction
{
  Q_OBJECT
private:
  ScriptRunner* scriptRunner = Q_NULLPTR;
  MEMSDataHandler* mEMSDataHandler = Q_NULLPTR;
public:
  InstructionDataReaderStopCollection()
  {
    scriptRunner = ScriptInstruction::getScriptRunner();
    mEMSDataHandler = ScriptInstruction::getMEMSDataHandler();
    instructionFlag = Instruction_DataReader_StopCollection;
  }
  ~InstructionDataReaderStopCollection()
  {}
public:
  void run()override
  {
    mEMSDataHandler->slot_stopDataCollection();
    StateChecker<bool, MEMSDataHandler >::next_ifConditionReached(&MEMSDataHandler::getIsListen, mEMSDataHandler, false, scriptRunner->getTime_connectTimeOut(),scriptRunner);
  }
  QVector<float> getDataForSaving()override
  {
    QVector<float> savingData;
    savingData.append(instructionFlag);
    return savingData;
  }
};
#endif
